home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cpptutor.arc / TRUCK.CPP < prev    next >
Text File  |  1991-04-28  |  425b  |  28 lines

  1.                                   // Chapter 7 - Program 7
  2. #include "truck.hpp"
  3.  
  4. void truck::init_truck(int how_many, float max_load)
  5. {
  6.    passenger_load = how_many;
  7.    payload = max_load;
  8. }
  9.  
  10.  
  11. float truck::efficiency(void)
  12. {
  13.    return payload / (payload + get_weight());
  14. }
  15.  
  16.  
  17. int truck::passengers(void)
  18. {
  19.    return passenger_load;
  20. }
  21.  
  22.  
  23.  
  24.  
  25. // Result of execution
  26. //
  27. // (this file cannot be executed)
  28.